/**
 *  \file   conf.c
 *  \brief  eZ430-RF2500 tutorial
 *  \author Miora ANDRIAMANOHARISOA, Loic MINGHETTI
 *  \date   PFE 2011
 **/

#include "include.h"

static int config_node_id;
static int config_hop_count;
static int config_offset;
#define UNDEFINED 0
#define DEFINED 1

void init_configuration(void) {
  config_node_id = UNDEFINED;
  config_hop_count = UNDEFINED;
  config_offset = UNDEFINED;
}

void set_configuration_defined(void) {
  config_node_id = DEFINED;
  config_hop_count = DEFINED;
  config_offset = DEFINED;
}

/* informe si le noeud a été configuré par un utilisateur ou s'il est resté dans la configuration initiale par défaut */
int node_configuration(void){
  if ( (config_node_id == DEFINED) && (config_hop_count == DEFINED) && (config_offset == DEFINED) ) {
    return DEFINED;
  } else return UNDEFINED;
}

void set_node_id_defined(void) {
  config_node_id = DEFINED;
}

void set_hop_count_defined(void) {
  config_hop_count = DEFINED;
}

void set_offset_defined(void) {
  config_offset = DEFINED;
}